//导入Vue资源包
import Vue from 'vue'
//导入Router资源包
import VueRouter from 'vue-router'
import Father from "@/components/Father";
import Son from "@/components/Son";
import Home from "@/components/Home";
import Movie from "@/components/Movie";
import News from "@/components/News";
import About from "@/components/About";
import Tab1 from "@/components/tab/Tab1";
import Tab2 from "@/components/tab/Tab2";
//把VueRouter安装到Vue实例上
Vue.use(VueRouter)
//创建Router的实例对象
const router = new VueRouter({
    routes:[
        //路由重定向配置
        {path: '/',redirect:'/home'},
        {
            path:'/father',component:Father
        },{
            path: '/son',component: Son
        },
        {path: '/home',component: Home},
        //props = true 代表开启动态传值功能
        {path: '/movie/:id',component: Movie,props:true},
        {path: '/news',component: News},
        {
            path: '/about',
            component: About,
            //子路由重定向
            redirect: '/about/tab1',
            children:[
                //子路由不用写/
                {path:'tab1',component:Tab1},
                {path: 'tab2',component: Tab2}
            ]
        }
    ]
})
//向外部共享路由的实例对象
export default router